Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Android): Migrate Hermes Instruments to Kotlin #48378

Conversation

TheRogue76
Copy link
Contributor

@TheRogue76 TheRogue76 commented Dec 24, 2024

Summary:

Time to migrate some of Hermes's instruments. I see that HermesMemoryDumper(react/hermes/instrumentation/HermesMemoryDumper.h) implements the interface on C++, but not sure if i need to update the getId call to just id (same with getInternalStorage) or if the interop between Kotlin and Java applies to these things as well. @cortinico Any thoughts on your side would be appreciated.
HermesSamplingProfiler just became an object, since it was a singleton and a static anyway.
Here is what HermesMemoryDumper.h looks like:
Screenshot 2024-12-24 at 10 03 00

Updated: I ended up making them match the function signature on Cxx, because even if it does have that implicit behavior, doesn't feel right to tap into it like this.

Changelog:

[INTERNAL] [FIXED] - Migrate HermesMemoryDumper and HermesSamplingProfiler to Kotlin

Test Plan:

/gradlew test:
Screenshot 2024-12-24 at 09 54 29

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Dec 24, 2024
…utorFactory so it markes the NonNull values it overrides correctly.
@@ -34,6 +35,7 @@ public void setDebuggerName(String debuggerName) {
mDebuggerName = debuggerName;
}

@NonNull
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaScriptExecutorFactory explicitly marks these values as non nullable, so it is ok to mark them here as well.
Screenshot 2024-12-24 at 23 27 06

Comment on lines -13 to +14
String getInternalStorage();
public fun getInternalStorage(): String

String getId();
public fun getId(): String
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked these as String and not String? since in Cxx the return type is std::string and not a pointer, but i do see some pointer shenanigans going on over there. Will leave it up to the person who reviews to give their thoughts as well. I can not find any use of this class anywhere, in Cxx or in the JVM land so i can't tell by usage

@facebook-github-bot
Copy link
Contributor

@philIip has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@TheRogue76
Copy link
Contributor Author

Hi @philIip. Can you please tell me what this change broke? Guessing the linter thing is because of character spacing but other than that i have no idea what this could have broken

@cortinico
Copy link
Contributor

Hi @philIip. Can you please tell me what this change broke? Guessing the linter thing is because of character spacing but other than that i have no idea what this could have broken

Hey @TheRogue76, there are some changes needed to let this code compile with the internal codebase, but those are unrelated to your changes. The PR on GitHub is good to go, and @philIip should be able to merge it in the coming days.

Just note that due to holidays things were slower than usual so it might take a little longer till we're able to merge this one

@TheRogue76
Copy link
Contributor Author

Hi @philIip. Can you please tell me what this change broke? Guessing the linter thing is because of character spacing but other than that i have no idea what this could have broken

Hey @TheRogue76, there are some changes needed to let this code compile with the internal codebase, but those are unrelated to your changes. The PR on GitHub is good to go, and @philIip should be able to merge it in the coming days.

Just note that due to holidays things were slower than usual so it might take a little longer till we're able to merge this one

Much appreciated @cortinico . No rush on my side.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 7, 2025
@facebook-github-bot
Copy link
Contributor

@philIip merged this pull request in d22dbb5.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @TheRogue76 in d22dbb5

When will my fix make it into a release? | How to file a pick request?

@TheRogue76 TheRogue76 deleted the feature/migrate-instruments-to-kotlin branch January 7, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants